<?php

namespace spec\AppBundle\Controller;

use AppBundle\Controller\DefaultController;
use AppBundle\Service\UserService;
use AppBundle\Service\LogService;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class DefaultControllerSpec extends ObjectBehavior
{
    function let(LogService $logger){
      $this->beConstructedWith($logger);
    }

    function it_is_initializable()
    {
        $this->shouldHaveType(DefaultController::class);
    }

    function it_converts_plain_text_to_html_paragraphs(){
      $this->toHtml('hello')->shouldReturn("<p>hello</p>");
    }

    function it_converts_text_from_an_external_source(UserService $service){
      $service->getUser()->willReturn('ttg');

      $this->toHtmlFromReader($service)->shouldReturn("<p>ttg</p>");
    }

    function it_outputs_converted_text(LogService $logger){


        $logger->log("<p>ttg</p>")->shouldBeCalled();
        $this->outHtml("ttg");

  //$logger->log("<p>ttg</p>")->shouldHaveBeenCalled();

    }
}
